# What is a regular expression?

Top Previous Next

A regular expression is a way of describing a group of words (referred to as a 'string'). It allows a user to build a complex set of rules to describe exactly what characteristics the string should have. While this documentation uses the word string you can think of a string as either a filename when searching for a filename using regular expressions, or as text in a document when using a regular expression to search the contents of files.

The simplest regular expression is a sequence of letters, numbers, or both. Such a regular expression matches any string that contains that sequence. For example:

The regular expression `foo' matches any string containing `foo'. So if you wanted to find a file with the letters 'fred' in it the regular expression would simply be 'fred'.

This is obviously a very simple example but you can express complicated rules. For example:

To find a file that begins with 'July' or 'August' followed at some point by 'Document' or 'Documents' followed at some point by a number and has a '.doc' extension the expression would be: '^(July|August).*Documents?.*[0-9]+.*\.doc$'

This expression would find:

•JulysPrivDocuments_23.doc

•August Documents Num5a.doc

•etc.

Don't worry if the expression above looks confusing because it is. That is why Agent Ransack includes an Expression Wizard to guide you through building regular expressions using common English terms.

For more information please read regular expression basics.

Note: You can test out your expression against the Agent Ransack regular expression engine through the 'Tools' -> 'Regular Expression Tester...' menu option.

Copyright © 2026 Mythicsoft Ltd. All rights reserved.
Help file version: 9.0
PDF and CHM versions of this help file are available here:
http://mythicsoft.com/filelocatorpro/help